Skip to content

refactor(assembly): split tests.rs into thematic test modules - #3379

Open
haileymarshall wants to merge 1 commit into
0xMiden:nextfrom
haileymarshall:refactor-split-assembly-tests
Open

refactor(assembly): split tests.rs into thematic test modules#3379
haileymarshall wants to merge 1 commit into
0xMiden:nextfrom
haileymarshall:refactor-split-assembly-tests

Conversation

@haileymarshall

@haileymarshall haileymarshall commented Jul 15, 2026

Copy link
Copy Markdown

Closes #3065

Rationale

crates/assembly/src/tests.rs had grown to 7.6k lines / 233 tests, which makes it slow to
navigate, causes unrelated changes to collide in the same file, and buries which area a
failing test belongs to. #3065 asks for it to be split up now that #3073 has landed. Smaller
thematic modules make it obvious where a new test belongs and keep future diffs scoped to the
area they touch.

What changed

Splits tests.rs into crates/assembly/src/tests/:

  • One module per existing // SECTION header (simple programs, libraries, constants,
    assertions, imports, errors, etc.). Test code is moved verbatim.
  • The MAST TESTS section had grown into a ~3.7k-line catch-all, so it is further split by
    theme: mast, kernels (incl. syscall resolution), forest_merge, linking_imports,
    package_surface, link_diagnostics, cross_module_constants, link_cycles,
    import_regressions, symbol_resolution, link_expansion, num_locals,
    misc_regressions. Happy to regroup if you'd prefer different boundaries.
  • Shared imports, helpers, and the assert_assembler_diagnostic! macro live in tests/mod.rs;
    each module starts with use super::*;.
  • Insta snapshot files are renamed to their new module paths and their source: headers
    updated. The orphaned nested_blocks_hash.snap is deleted (its assertion was removed
    in Simplify MastForestBuilder with builder-local refs #3142).
  • Added a CHANGELOG.md entry.

Test plan / how to review

  • Test code is moved verbatim — no test logic was changed. Reviewing module-by-module against
    the old // SECTION boundaries should show only relocation plus the use super::*; preamble.
  • Test count is unchanged: cargo test -p miden-assembly runs the same 233 tests as before
    the split (plus 1 in the pre-existing package.rs), all passing.
  • Snapshot files are git mv-renamed, so the diff shows them as renames; only their source:
    headers changed.
  • cargo fmt (stable and nightly) and
    cargo clippy -p miden-assembly --all-targets --all-features are green.

Split the 7.6k-line tests.rs into crates/assembly/src/tests/ with one
module per existing section header, and break the MAST TESTS section
into thematic modules (kernels, forest merging, linking, packages,
symbol resolution, etc.).

Shared imports, helpers, and the assert_assembler_diagnostic macro stay
in tests/mod.rs; test code is moved verbatim. Insta snapshots are
renamed to their new module paths, and the orphaned
nested_blocks_hash.snap (its assertion was removed in 0xMiden#3142) is
deleted.
@haileymarshall
haileymarshall force-pushed the refactor-split-assembly-tests branch from 1f93158 to f649fda Compare July 15, 2026 14:02

@huitseeker huitseeker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So sorry about the late review. This LGTM, but needs a rebase: since the PR branched, next added four tests, removed one, and changed two function bodies. Those changes must be deliberately moved into the new modules during a refresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split up assembly tests

2 participants